﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard;
using Orchard.ContentManagement;
using Orchard.Environment.Extensions;
using Downplay.Audit.Models;

namespace Downplay.Audit.Services
{
    public interface IAuditService : IDependency
    {
        /// <summary>
        /// Creates an audit record
        /// </summary>
        /// <param name="auditCode">A codename to identify the type of audit event</param>
        /// <param name="content">Content item to record the audit against (can be null)</param>
        /// <param name="completed">Indicates that this is a one-time audit rather than an event over time, so it can be marked as completed immediately</param>
        /// <returns></returns>
        AuditRecord CreateAudit(string auditCode, IContent content = null, bool completed = true, string data = "");

        /// <summary>
        /// Retrieve an audit record for updating
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        AuditRecord GetAudit(long auditId);

        /// <summary>
        /// Marks the audit event as completed
        /// </summary>
        /// <param name="auditId"></param>
        /// <returns></returns>
        bool CompleteAudit(long auditId);

        /// <summary>
        /// Generates an absolute callback URL to complete the audit event
        /// </summary>
        /// <param name="audit"></param>
        /// <returns></returns>
        string AuditCompletionUrl(AuditRecord audit);

        /// <summary>
        /// Get user's current location details
        /// TODO: This possibly doesn't need to be public, we can use events instead to hook into this
        /// </summary>
        /// <returns></returns>
        UserLocationRecord CurrentUserLocation();

    }
}
